package org.example01.System1;

import java.util.HashMap;
import java.util.Map;

public enum studentStatus {
    Enrollment("在读"),
    Suspended("休学"),
    Graduated("毕业");
    private String status;
    public  static Map<String,studentStatus> map= new HashMap<>();//哈希表用于存储枚举对象和值
    private studentStatus(String status) {
        this.status = status;
    }

    static {
        for (studentStatus value : studentStatus.values()) {
            map.put(value.status,value);
        }
    }//利用静态代码块将哈希表初始化
    public static studentStatus getStatus(String status) {
        return map.get(status);
    }

    public String toString() {
        return status;
    }
}
